package com.tejava.cafe_in;
import android.os.Parcel;
import android.os.Parcelable;
public class ShopData implements Parcelable{
	String title="";
	String description="";
	String telephone="";
	String address="";
	String mapX="";
	String mapY="";
	double wgsX = 0;
	double wgsY = 0;
	double distance=0;
	double point = 0;
	String cafeId="";
	int reviewCount = 0;
	
	public static final Parcelable.Creator<ShopData> CREATOR = new Parcelable.Creator<ShopData>() {
		public ShopData createFromParcel(Parcel in) {
			return new ShopData(in);
		}

		public ShopData[] newArray(int size) {
			return new ShopData[size];
		}
	};
	
	
	public ShopData(){
	}
	
	
	
	public ShopData(Parcel in) {
		String[] data= new String[11];
		in.readStringArray(data);
	
		this.title = data[0];
		this.description = data[1];
		this.telephone =data[2];
		this.address = data[3];
		this.mapX = data[4];
		this.mapY = data[5];
		this.wgsX = Double.parseDouble(data[6]);
		this.wgsY =  Double.parseDouble(data[7]);
		this.distance =  Double.parseDouble(data[8]);
		this.point =  Double.parseDouble(data[9]);
		this.cafeId = data[10];
	}
	
	
	
	public ShopData(ShopData a){
		this.title = a.title;
		this.description = a.description;
		this.telephone = a.telephone;
		this.address = a.address;
		this.mapX = a.mapX;
		this.mapY = a.mapY;
		this.wgsX = a.wgsX;
		this.wgsY = a.wgsY;
		this.distance = a.distance;
		this.point = a.point;
		this.cafeId = a.cafeId;
		
	}
	
	public ShopData(ShopData a, double wgsX, double wgsY, double distance){
		this.title = a.title;
		this.description = a.description;
		this.telephone = a.telephone;
		this.address = a.address;
		this.mapX = a.mapX;
		this.mapY = a.mapY;
		this.wgsX = wgsX;
		this.wgsY = wgsY;
		this.distance = distance;
		this.point = a.point;
		this.cafeId = a.cafeId;
	
	}
	
	
	public ShopData(ShopData a, double wgsX, double wgsY){
		this.title = a.title;
		this.description = a.description;
		this.telephone = a.telephone;
		this.address = a.address;
		this.mapX = a.mapX;
		this.mapY = a.mapY;
		this.wgsX = wgsX;
		this.wgsY = wgsY;
		this.distance = a.distance;
		this.point = a.point;
		this.cafeId = a.cafeId;
		
	
	}
	public double getDistance(){
		return distance;
	}
	
	public double getPoint(){
		return point;
	}

	@Override
	public int describeContents() {
		// TODO Auto-generated method stub
		return 0;
	}

	@Override
	public void writeToParcel(Parcel arg0, int arg1) {
		// TODO Auto-generated method stub
		arg0.writeStringArray(new String[]{this.title,this.description,this.telephone, 
				this.address,this.mapX, this.mapY, String.valueOf(this.wgsX),
				String.valueOf(this.wgsY),String.valueOf(this.distance),
				String.valueOf(this.point),this.cafeId});
	}
	
	public void setShopData(ShopData a){
		this.title = a.title;
		this.description = a.description;
		this.telephone = a.telephone;
		this.address = a.address;
		this.mapX = a.mapX;
		this.mapY = a.mapY;
		this.wgsX = a.wgsX;
		this.wgsY = a.wgsY;
		this.distance = a.distance;
		this.point = a.point;
		this.cafeId = a.cafeId;
		this.reviewCount = a.reviewCount;
		
	}
	
	public void setPoint(Double point){
		this.point = point;
	}
	
	public void setReviewCount(int count){
		this.reviewCount = count;
	}
}
